package com.example.dml.generics;

import java.util.ArrayList;
import java.util.List;

/**
 * @Authors：gaoyang
 * @CreateTime：2021-10-29
 * @Description：todo
 */
public class Generic02 {

    private <T> void test(List<? super T> dst,List<T> srcs){
        for (T t:srcs){
            dst.add(t);
        }
    }

    public static void main(String[] args) {
        List<Dog> dogs = new ArrayList<>();
        for (int i=0;i<10;i++){
            Dog dog = new Dog();
            dog.setLeg(i);
            dogs.add(dog);
        }
        List<Animal> animals = new ArrayList<>();
        new Generic02().test(animals,dogs);
    }
}
